home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / QuickTime VR / MacOS / QuickDraw™ 3D 1.0.6F4 SDK / Development / Interfaces / QD3DViewer.h < prev   
Encoding:
C/C++ Source or Header  |  1995-11-14  |  8.6 KB  |  306 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                              **
  3.  **     Module:        QD3DViewer.h                                             **                        
  4.  **                                                                              **
  5.  **                                                                              **
  6.  **     Purpose:     Viewer Controller Interface File.                         **            
  7.  **                                                                              **
  8.  **                                                                              **
  9.  **     Copyright (C) 1994-1995 Apple Computer, Inc.  All rights reserved.     **
  10.  **                                                                              **
  11.  **                                                                              **
  12.  *****************************************************************************/
  13.  
  14. #ifndef QD3DViewer_h
  15. #define QD3DViewer_h
  16.  
  17. #ifndef QD3D_h
  18. #include <QD3D.h>
  19. #endif  /*  QD3D_h  */
  20.  
  21. #if PRAGMA_ONCE
  22.     #pragma once
  23. #endif
  24.  
  25. #if defined(__MWERKS__)
  26.     #pragma enumsalwaysint on
  27.     #pragma align_array_members off
  28.     #pragma options align=native
  29. #endif
  30.  
  31. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  32.  
  33. #include <Events.h>
  34. #include <Types.h>
  35. #include <Windows.h>
  36.  
  37. #include <QD3DGroup.h>
  38.  
  39. typedef void *TQ3ViewerObject;
  40.  
  41. enum {
  42.     kQ3ViewerShowBadge             = 1<<0,
  43.     kQ3ViewerActive                = 1<<1,
  44.     kQ3ViewerControllerVisible    = 1<<2,
  45.     kQ3ViewerDrawFrame            = 1<<3,
  46.     kQ3ViewerDraggingOff        = 1<<4,
  47.     
  48.     kQ3ViewerButtonCamera        = 1<<5,
  49.     kQ3ViewerButtonTruck        = 1<<6,
  50.     kQ3ViewerButtonOrbit        = 1<<7,
  51.     kQ3ViewerButtonZoom            = 1<<8,
  52.     kQ3ViewerButtonDolly        = 1<<9,
  53.     
  54.  
  55.     kQ3ViewerDefault = (
  56.                 kQ3ViewerActive        | kQ3ViewerControllerVisible | 
  57.                 kQ3ViewerButtonCamera  | kQ3ViewerButtonTruck       | 
  58.                 kQ3ViewerButtonOrbit   | kQ3ViewerButtonDolly )
  59. };
  60.  
  61. enum {
  62.     kQ3ViewerEmpty    = 0,
  63.     kQ3ViewerHasModel = 1<<0
  64. };
  65.  
  66. enum {
  67.     gestaltQD3DViewer            = 'q3vc',
  68.     gestaltQD3DViewerNotPresent    = 0,
  69.     gestaltQD3DViewerAvailable    = 1
  70. };
  71.  
  72. #ifdef __cplusplus
  73. extern "C" {
  74. #endif    /* __cplusplus */
  75.  
  76. /******************************************************************************
  77.  **                                                                             **
  78.  **                        Creation and destruction                             **
  79.  **                Note that this is not a QuickDraw 3D object                     **
  80.  **                                                                             **
  81.  *****************************************************************************/
  82.  
  83. TQ3ViewerObject Q3ViewerNew(
  84.     CGrafPtr        port,
  85.     Rect            *rect,
  86.     unsigned long    flags);
  87.     
  88. OSErr Q3ViewerDispose(
  89.     TQ3ViewerObject theViewer);
  90.  
  91. /******************************************************************************
  92.  **                                                                             **
  93.  **                    Functions to attach data to a viewer                     **
  94.  **                                                                             **
  95.  *****************************************************************************/
  96.  
  97. OSErr Q3ViewerUseFile(
  98.     TQ3ViewerObject    theViewer,
  99.     long            refNum);
  100.     
  101. OSErr Q3ViewerUseData(
  102.     TQ3ViewerObject    theViewer,
  103.     void            *data,
  104.     long            size);
  105.  
  106. /******************************************************************************
  107.  **                                                                             **
  108.  **        Functions to write data out from the Viewer                             **
  109.  **                                                                             **
  110.  *****************************************************************************/
  111.  
  112. OSErr Q3ViewerWriteFile(
  113.     TQ3ViewerObject    theViewer,
  114.     long            refNum);
  115.     
  116. unsigned long Q3ViewerWriteData(
  117.     TQ3ViewerObject    theViewer,
  118.     void            **data);
  119.  
  120. /******************************************************************************
  121.  **                                                                             **
  122.  **        Use this function to force the Viewer to re-draw                     **
  123.  **                                                                             **
  124.  *****************************************************************************/
  125.  
  126. OSErr Q3ViewerDraw(
  127.     TQ3ViewerObject theViewer);
  128.  
  129. /******************************************************************************
  130.  **                                                                             **
  131.  **        Function used by the Viewer to filter and handle events                 **
  132.  **                                                                             **
  133.  *****************************************************************************/
  134.  
  135. Boolean Q3ViewerEvent(
  136.     TQ3ViewerObject    theViewer,
  137.     EventRecord        *evt);
  138.  
  139. /******************************************************************************
  140.  **                                                                             **
  141.  **        This function returns a PICT of the contents of the                  **
  142.  **        Viewer's window.  The application should dispose the PICT.             **
  143.  **                                                                             **
  144.  *****************************************************************************/
  145.  
  146. PicHandle Q3ViewerGetPict(
  147.     TQ3ViewerObject theViewer);
  148.  
  149. /******************************************************************************
  150.  **                                                                             **
  151.  **                        Calls for dealing with Buttons                         **
  152.  **                                                                             **
  153.  *****************************************************************************/
  154.  
  155. OSErr Q3ViewerGetButtonRect(
  156.     TQ3ViewerObject    theViewer,
  157.     unsigned long    button,
  158.     Rect            *rect);
  159.  
  160. unsigned long Q3ViewerGetCurrentButton(
  161.     TQ3ViewerObject    theViewer);
  162.     
  163. OSErr Q3ViewerSetCurrentButton(
  164.     TQ3ViewerObject    theViewer,
  165.     unsigned long    button);
  166.  
  167. /******************************************************************************
  168.  **                                                                             **
  169.  **        Functions to set/get the group to be displayed by the Viewer.         **
  170.  **                                                                             **
  171.  *****************************************************************************/
  172.  
  173. OSErr Q3ViewerUseGroup(
  174.     TQ3ViewerObject    theViewer,
  175.     TQ3GroupObject    group);
  176.     
  177. TQ3GroupObject Q3ViewerGetGroup(
  178.     TQ3ViewerObject    theViewer);
  179.  
  180. /******************************************************************************
  181.  **                                                                             **
  182.  **        Functions to set/get the color used to clear the window                 **
  183.  **                                                                             **
  184.  *****************************************************************************/
  185.  
  186. OSErr Q3ViewerSetBackgroundColor(
  187.     TQ3ViewerObject    theViewer,
  188.     TQ3ColorARGB    *color);
  189.     
  190. OSErr Q3ViewerGetBackgroundColor(
  191.     TQ3ViewerObject    theViewer,
  192.     TQ3ColorARGB    *color);
  193.  
  194. /******************************************************************************
  195.  **                                                                             **
  196.  **        Getting/Setting a Viewer's View object.  Disposal is needed.         **
  197.  **                                                                             **
  198.  *****************************************************************************/
  199.  
  200. TQ3ViewObject Q3ViewerGetView(
  201.     TQ3ViewerObject    theViewer);
  202.  
  203. OSErr Q3ViewerRestoreView(
  204.     TQ3ViewerObject    theViewer);
  205.  
  206. /******************************************************************************
  207.  **                                                                             **
  208.  **        Calls for setting/getting viewer flags                                 **
  209.  **                                                                             **
  210.  *****************************************************************************/
  211.  
  212. OSErr Q3ViewerSetFlags(
  213.     TQ3ViewerObject    theViewer,
  214.     unsigned long    flags);
  215.     
  216. unsigned long Q3ViewerGetFlags(
  217.     TQ3ViewerObject    theViewer);
  218.  
  219. /******************************************************************************
  220.  **                                                                             **
  221.  **        Calls related to bounds/dimensions.  Bounds is the size of              **
  222.  **        the window.  Dimensions can either be the Rect from the ViewHints     **
  223.  **        or the current dimensions of the window (if you do a Set).             **
  224.  **                                                                             **
  225.  *****************************************************************************/
  226.  
  227. OSErr Q3ViewerSetBounds(
  228.     TQ3ViewerObject    theViewer,
  229.     Rect            *bounds);
  230.     
  231. OSErr Q3ViewerGetBounds(
  232.     TQ3ViewerObject    theViewer,
  233.     Rect            *bounds);
  234.  
  235. OSErr Q3ViewerGetDimension(
  236.     TQ3ViewerObject    theViewer,
  237.     unsigned long    *width,
  238.     unsigned long    *height);
  239.  
  240. /******************************************************************************
  241.  **                                                                             **
  242.  **                            Port related calls                                 **
  243.  **                                                                             **
  244.  *****************************************************************************/
  245.  
  246. OSErr Q3ViewerSetPort(
  247.     TQ3ViewerObject    theViewer,
  248.     CGrafPtr        port);
  249.     
  250. CGrafPtr Q3ViewerGetPort(
  251.     TQ3ViewerObject    theViewer);
  252.  
  253. /******************************************************************************
  254.  **                                                                             **
  255.  **        Adjust Cursor should be called from idle loop to allow the Viewer     **
  256.  **        to change the cursor according to the cursor position/object under     **
  257.  **        the cursor.                                                             **
  258.  **                                                                             **
  259.  *****************************************************************************/
  260.  
  261. Boolean Q3ViewerAdjustCursor(
  262.     TQ3ViewerObject    theViewer,
  263.     Point            *pt);
  264.  
  265. /******************************************************************************
  266.  **                                                                             **
  267.  **        Returns the state of the viewer.  See the constant defined at the     **
  268.  **        top of this file.                                                     **
  269.  **                                                                             **
  270.  *****************************************************************************/
  271.  
  272. unsigned long Q3ViewerGetState(
  273.     TQ3ViewerObject    theViewer);
  274.  
  275. /******************************************************************************
  276.  **                                                                             **
  277.  **                            Clipboard utilities                                 **
  278.  **                                                                             **
  279.  *****************************************************************************/
  280.  
  281. OSErr Q3ViewerClear(
  282.     TQ3ViewerObject    theViewer);
  283.     
  284. OSErr Q3ViewerCut(
  285.     TQ3ViewerObject    theViewer);
  286.     
  287. OSErr Q3ViewerCopy(
  288.     TQ3ViewerObject    theViewer);
  289.     
  290. OSErr Q3ViewerPaste(
  291.     TQ3ViewerObject    theViewer);
  292.  
  293. #ifdef __cplusplus
  294. }
  295. #endif    /* __cplusplus */
  296.  
  297. #endif     /* OS_MACINTOSH */
  298.  
  299. #if defined(__MWERKS__)
  300. #pragma options align=reset
  301. #pragma enumsalwaysint reset
  302. #endif
  303.  
  304. #endif    /* QD3DViewer_h */
  305.  
  306.